<template>
  <div class="toast" v-if="show">
    <span class="message">{{ message }}</span>
  </div>
</template>

<script>
export default {
  name: 'Toast',
  data() {
    return {
      show: false,
      message: '',
    };
  },
  methods: {
    showMessage(message) {
      this.message = message;
      this.show = true;
      setTimeout(() => {
        this.show = false;
      }, 3000);
    },
  },
};
</script>

<style scoped>
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.message {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
}
</style>
